package so.ifl.servcie.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import so.ifl.dao.StaffInfoDao;
import so.ifl.servcie.StaffService;
import so.ifl.vo.StaffDetailVo;
import so.ifl.vo.StaffVo;

/**
 *create by aaron.lu
 *create at 2013-3-10 上午8:58:08
 *<mailto: atyuan.lu@gmail.com>
 **/
@Service("staffService")
public class StaffServiceImpl implements StaffService {
	
	@Autowired
	private StaffInfoDao staffInfoDao;
	
	/**
	 * 查询员工信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:00:22
	 * <mailto: atyuan.lu@gmail.com>
	 * @param params
	 * @param offset
	 * @param limit
	 * @return
	 *
	 */
	public List<StaffVo> queryStaffWithParamAndPagination(Map<String, Object> params, Integer offset, Integer limit){
		return staffInfoDao.queryStaffWithParamAndPagination(params, new RowBounds(offset, limit));
	}
	
	/**
	 * 统计员工数目
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:01:43
	 * <mailto: atyuan.lu@gmail.com>
	 * @param params
	 * @return
	 *
	 */
	public Integer countStaffWithParam(Map<String, Object> params){
		return staffInfoDao.countStaffWithParam(params);
	}
	
	/**
	 * 查询员工明细信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:03:24
	 * <mailto: atyuan.lu@gmail.com>
	 * @param params
	 * @param offset
	 * @param limit
	 * @return
	 *
	 */
	public List<StaffDetailVo> queryStaffDetail(Map<String, Object> params, Integer offset, Integer limit){
		return staffInfoDao.queryStaffDetail(params, new RowBounds(offset, limit));
	}
	
	/**
	 * 新增员工信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:04:32
	 * <mailto: atyuan.lu@gmail.com>
	 * @param staffVo
	 *
	 */
	public void insertStaff(StaffVo staffVo){
		staffInfoDao.insertStaff(staffVo);
	}
	
	/**
	 * 新增员工明细
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:06:04
	 * <mailto: atyuan.lu@gmail.com>
	 * @param staffDetailVo
	 *
	 */
	public void insertStaffDetail(StaffDetailVo staffDetailVo){
		staffInfoDao.insertStaffDetail(staffDetailVo);
	}
	
	/**
	 * 删除员工信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:07:29
	 * <mailto: atyuan.lu@gmail.com>
	 * @param staffId
	 *
	 */
	public void deleteStaff(Integer staffId){
		staffInfoDao.deleteStaff(staffId);
	}
	
	/**
	 * 删除员工明细信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:08:33
	 * <mailto: atyuan.lu@gmail.com>
	 * @param staffDetailId
	 *
	 */
	public void deleteStaffDetail(Integer staffDetailId){
		staffInfoDao.deleteStaffDetail(staffDetailId);
	}
	
	/**
	 * 更新员工信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:09:57
	 * <mailto: atyuan.lu@gmail.com>
	 * @param staffVo
	 *
	 */
	public void updateStaff(StaffVo staffVo){
		staffInfoDao.updateStaff(staffVo);
	}
	
	/**
	 * 更新员工明细信息
	 * create by aaron.lu
	 * create at 2013-3-10 上午9:10:58
	 * <mailto: atyuan.lu@gmail.com>
	 * @param staffDetailVo
	 *
	 */
	public void updateStaffDetail(StaffDetailVo staffDetailVo){
		staffInfoDao.updateStaffDetail(staffDetailVo);
	}

}
